using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

namespace Crossborder.Domian.Orders
{
    public class OrderMaster : BaseEntity
    {
        /// <summary>
        /// 订单Guid
        /// </summary>
        /// <value></value>
        [Comment("订单Guid")]
        public string OrderMasterGuid { get; set; }

        /// <summary>
        /// 订单号
        /// </summary>
        /// <value></value>
        [Comment("订单号")]
        public string OrderNo { get; set; }

        /// <summary>
        /// 用户Id
        /// </summary>
        /// <value></value>
        [Comment("用户Id")]
        public string UserId { get; set; }

        /// <summary>
        /// 下单时间
        /// </summary>
        /// <value></value>
        [Comment("下单时间")]
        public DateTime InputDate { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        /// <value></value>
        [Comment("备注")]
        public string? Remark { get; set; }

        /// <summary>
        /// 邮寄地址
        /// </summary>
        /// <value></value>
        [Comment("邮寄地址")]
        public string Address { get; set; }

        /// <summary>
        /// 支付状态：0 待支付，1 已支付，2 已取消
        /// </summary>
        /// <value></value>
        [Comment("支付状态：0 待支付，1 已支付，2 已取消")]
        public int PayState { get; set; }

        public void Create()
        {
            this.OrderMasterGuid = Guid.NewGuid().ToString();
            this.CreateDate = DateTime.Now;
            this.IsDelete = false;
            this.IsEnabled = true;
            this.PayState = 0;
        }

        public void IsPayState(int payState)
        {
            this.PayState = payState;
            this.ModifyDate = DateTime.Now;
        }
    }
}